perm filename TRIM.SAI[LIB,AIL] blob
sn#408161 filedate 1979-01-09 generic text, type T, neo UTF8
entry trim;
begin "trim"
define library!entry = true;
require "sys:std.hdr" source!file;
internal simple string procedure trim(string x);
begin "trim"
! TRIM returns a copy of its argument with leading and trailing
blanks removed. If the string is all blank then the
null string will be returned. If the original
string was null then the result will also be null;
while (length(x) > 1) and (x[1 for 1] = " ") do
x ← x[2 to inf];
while (length(x) > 1) and (x[inf for 1] = " ") do
x ← x[1 to inf-1];
if equ(x," ") then
x := null;
return(x);
end "trim";
end "trim"